﻿using DotNetDAL.Entity;

namespace DotNetDAL.Connector
{
    /// <summary>
    /// 事务处理器
    /// </summary>
    public interface ITransactor
    {
        /// <summary>
        /// 执行SQL语句
        /// </summary>
        /// <param name="sql"></param>
        /// <param name="whereParamObj">实体参数对象或 Dictionary<string, object> </param>
        /// <returns></returns>
        int ExecuteNonQuery(string sql, object whereParamObj = null);
        /// <summary>
        /// 实体操作-添加数据
        /// </summary>
        /// <param name="table_name"></param>
        /// <param name="paramObj"></param>
        bool Add(string table_name, object paramObj);
        /// <summary>
        /// 实体操作-更新数据
        /// </summary>
        /// <param name="table_name">表名</param>
        /// <param name="updateFieldParam">待更新的实体</param>
        /// <param name="whereSQL">where条件SQL</param>
        /// <param name="whereParamObj">where条件SQL参数</param>
        /// <returns></returns>
        bool Update(string table_name, object updateFieldParam, string whereSQL, object whereParamObj = null);
        /// <summary>
        /// 实体操作-更新数据
        /// </summary>
        /// <param name="table_name">表名</param>
        /// <param name="updateFieldParam">待更新的实体</param>
        /// <param name="whereParam">where条件参数</param>
        /// <returns></returns>
        bool Update(string table_name, object updateFieldParam, WhereParameter whereParam);

    }

}
